<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"   %>
<%@ taglib prefix="C" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="format-detection" content="telephone=no" />
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<link href="css/bksystem.css" rel="stylesheet" type="text/css" /> 
		<link href="font/iconfont.css" rel="stylesheet" type="text/css" />
		<link href="css/module.css" rel="stylesheet" type="text/css" />
		<link href="css/pages.css" rel="stylesheet" type="text/css" />
		<title>商品管理</title>
		<script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>
		<script src="js/jquery.nicescroll.js" type="text/javascript"></script>
		<script src="js/HUpages.js" type="text/javascript"></script>
		<script src="js/common.js" type="text/javascript"></script>
		<style>
			.divs{

				width: 100%;
				height: 30px;
				border: 1px solid bisque;
				text-align: center;
				color: red;
				background-color: wheat;
				text-align: center;
				line-height:2;

			}
		</style>


	</head>

<body id="situation">
<script src="../js/jquery1.42.min%20(1).js"></script>

<div class="pages-style" >


	<c:if test="${! empty revise}">
		<script>
			alert("${revise}")
		</script>
		<c:remove var="revise"></c:remove>
	</c:if>

	<!--左侧菜单栏-->
	<div class="bk-con-menu " id="bk-con-menu">
					<div class="menubtn">
						<span class="close_btn samebtn"><i>隐藏</i></span>
						<span class="show_btn samebtn"><i>显示</i></span>
					</div>
					<div class="title-menu">栏目分类</div>
					<div class="breadcrumb" id="breadcrumb">
						<ul class="clearfix menu-section menulist" id="menu-section">
							<div class="divs"   >
								<a href="order/quer.html?id=${Bus.id}&osid=2" >待发货</a>
							</div>
							<div class="divs"   >
								<a href="order/quer.html?id=${Bus.id}&osid=3" >已发货</a>
							</div>

							<div class="divs"   >
								<a href="order/quer.html?id=${Bus.id}&osid=5" >已完成</a>
							</div>

							<div class="divs"   >
								<a href="con/show.html?id=${Bus.id}" >商品管理</a>
							</div>
						</ul>
					</div>
				</div>
	<!--右侧内容-->
	<div class="bk-con-message message-section" id="iframe_box">
           <!--编辑内容-->
           <div class="operation  mb15">
           	<button class="btn button_btn btn-danger" type="button" onclick=""><i class="iconfont"></i>&nbsp;批量删除</button>
           	<button class="btn button_btn bg-deep-blue" type="button" onclick=""><i class="iconfont"></i>&nbsp;添加广告</button>
           	<button class="btn button_btn bg-deep-gray" type="button" onclick=""><i class="iconfont"></i>&nbsp;添加分类</button>
			   <div style="float:right; ">



			   <input type="text"  id="zhi"  placeholder="用户ID" />

			   <button id="all">查询</button>


		   </div>

           </div>

		<script>
          $("#all").click(function () {

                 // alert($("#zhi").val());
			  if($("#zhi").val()=="" ){
				  alert("不能为空值")
			  }else {




           $.ajax({
			   url:"order/querid.html",
			   type:"GET",
			   data:{ id: $("#zhi").val() },
               dataType:"json",
			   success:function(deta){
				   console.log(deta);
				   var str="";
				   str+="<tr>";
				   str+= "<th >订单编号</th>";
				   str+= "<th >用户编号</th>";
				   str+= "<th width='130' >联系电话a </th>";
				   str+= "<th >地址</th>";
				   str+= " <th >订单总价</th>";
				   str+=" <th >下单时间</th>";
				   str+=  "<th >状态</th>";
				   str+=  "<th >是否发货 </th>"
				   str+= "</tr>";
				   for (var i=0;i<deta.length;i++){
					   str+="<tr>";

						   console.log(11111111111111111)
						   str += "<td>" + deta[i].order_id + "</td>";
						   str += "<td>" + deta[i].user_id + "</td>";
						   str += "<td>" + deta[i].mobile + "</td>";
						   str += "<td>" + deta[i].country+deta[i].province+deta[i].city+deta[i].address+"</td>";
						   str += "<td>" +deta[i].order_amount+"</td>";
						   str += "<td>" +deta[i].add_time+"</td>";
                           if (deta[i].os_id==2){
                               str += "<td>" +"待发货"+deta[i].os_id+"</td>";

							   str += "<td> "+"<a href='order/revise.html?dingdanid=${deta[i].order_id}&osid=3&sjid=${deta[i].sb_id}' >"+ "<button> "+ "发货" +" </button>"+"</a>"+ "</td> ";
                           }else  if (deta[i].os_id==3){
                               str += "<td>" +"待收货"+"</td>";
							   str += "<td> "+"已发货"+ "</td> ";
                           }else {
                               str += "<td>" +"已完成"+"</td>";
							   str += "<td> "+"已完成"+ "</td> ";
                           }



						   str += "</tr>";



				   }


				   $("#tabe").html(str);
			   }


		  })

			  }

		  })








		</script>


           <!--列表内容-->
           <div class="page_content clearfix mb15 table-module ">
           	<table class="gallery table table_list table_striped table-bordered " id="tabe">

				<c:forEach begin="1" items="${order}" end="1" var="order">
					<c:if test="${ order.os_id==3}">
           		<thead>
		        <tr>
				<th >订单编号</th>
				<th >用户编号</th>
				<th width="130">联系电话</th>
				<th >地址</th>
				<th >订单总价</th>
				<th >下单时间</th>
				<th >状态</th>
				<th >详情内容 </th>
		       </tr>
		       </thead>
					</c:if>



					<c:if test="${ order.os_id==2}">
						<thead>
						<tr>
							<th >订单编号</th>
							<th >用户编号</th>
							<th width="130">联系电话</th>
							<th >地址</th>
							<th >订单总价</th>
							<th >下单时间</th>
							<th >状态</th>
							<th >是否发货 </th>
						</tr>
						</thead>
					</c:if>






					<c:if test="${ order.os_id==5}">
						<thead>
						<tr>
							<th >订单编号</th>
							<th >用户编号</th>
							<th width="130">联系电话</th>
							<th >地址</th>
							<th >订单总价</th>
							<th >下单时间</th>
							<th >状态</th>
							<th >详情内容 </th>
						</tr>
						</thead>
					</c:if>

				</c:forEach>
		       <tbody>



<%--			   打印输出--%>

           		<C:forEach items="${order}" var="order">
					<c:if test="${ order.os_id==3}">
           		<tr>
           		<td>${order.order_id} </td>
           		<td>${order.user_id}</td>
					<td>${order.mobile}</td>


           		<td>${order.country}${order.province}${order.city}${order.address}</td>
           		<td>${order.order_amount}</td>
           		<td>${order.add_time}</td>

					<c:if test="${ order.os_id==3}">
						<td>已发货</td>
					</c:if>

           		<td><button id="chakan"  onclick="chakan(this)" order="${order.order_id} "> 查看</button></td>
           		</tr>
					</c:if>
				</C:forEach>







<%--			  待收货 页面--%>

				<C:forEach items="${order}" var="order">
					<c:if test="${ order.os_id==2}">
						<tr>
							<td>${order.order_id} </td>
							<td>${order.user_id}</td>
							<td>${order.mobile}</td>


							<td>${order.country}${order.province}${order.city}${order.address}</td>
							<td>${order.order_amount}</td>
							<td>${order.add_time}</td>


							<c:if test="${ order.os_id==2}">
								<td>待发货</td>
							</c:if>


							<td><a href="order/revise.html?dingdanid=${order.order_id}&osid=3&sjid=${order.sb_id}"><button>发货</button></a></td>
						</tr>
					</c:if>
				</C:forEach>
<%--   完成订单页面--%>
				<C:forEach items="${order}" var="order">
					<c:if test="${ order.os_id==5}">
						<tr>
							<td>${order.order_id} </td>
							<td>${order.user_id}</td>
							<td>${order.mobile}</td>


							<td>${order.country}${order.province}${order.city}${order.address}</td>
							<td>${order.order_amount}</td>
							<td>${order.add_time}</td>


							<c:if test="${ order.os_id==5}">
								<td>已完成</td>
							</c:if>

							<td><button id="chakan1" onclick="chakan1(this)"  order1="${order.order_id}" > 查看</button></td>
						</tr>
					</c:if>
				</C:forEach>


<script>
	 function  chakan(e) {

		$.ajax({
			url: "order/queryAllId.html",
			type: "GET",
			data: {goodsid: $(e).attr("order")},
			dataType:"json",
			success :function(deta ) {
				// alert($("#zhi").val());

						console.log(deta);
						var str = "";
						str += "<tr>";
						str += "<th >详情编号</th>";
						str += "<th >所属订单编号</th>";
						str += "<th width='130' >SKU编号 </th>";
						str += "<th >购买价格</th>";
						str += " <th >购买数量</th>";

						str += "</tr>";
						for (var i = 0; i < deta.length; i++) {
							str += "<tr>";

							console.log(11111111111111111)
							str += "<td>" + deta[i].details_id + "</td>";
							str += "<td>" + deta[i].order_id + "</td>";
							str += "<td>" + deta[i].sku_id + "</td>";
							str += "<td>" + deta[i].buy_price + "</td>";
							str += "<td>" + deta[i].num + "</td>";


							str += "</tr>";


						}


						$("#tabe").html(str);
					}

				})








	 }




	 function  chakan1(e) {

		 $.ajax({
			 url: "order/queryAllId.html",
			 type: "GET",
			 data: {goodsid: $(e).attr("order1")},
			 dataType:"json",
			 success :function(deta ) {
				 // alert($("#zhi").val());

				 console.log(deta);
				 var str = "";
				 str += "<tr>";
				 str += "<th >详情编号</th>";
				 str += "<th >所属订单编号</th>";
				 str += "<th width='130' >SKU编号 </th>";
				 str += "<th >购买价格</th>";
				 str += " <th >购买数量</th>";

				 str += "</tr>";
				 for (var i = 0; i < deta.length; i++) {
					 str += "<tr>";

					 console.log(11111111111111111)
					 str += "<td>" + deta[i].details_id + "</td>";
					 str += "<td>" + deta[i].order_id + "</td>";
					 str += "<td>" + deta[i].sku_id + "</td>";
					 str += "<td>" + deta[i].buy_price + "</td>";
					 str += "<td>" + deta[i].num + "</td>";


					 str += "</tr>";


				 }


				 $("#tabe").html(str);
			 }

		 })








	 }
</script>







		       </tbody>



           	</table>
           </div>
    </div>
  </div>
 </body>
</html>
<script>
$(function(){
	//内页框架结构编辑
	$("#situation").Hupage({
		slide: '#breadcrumb',
		padding:15,
		menuModule:'#bk-con-menu', //菜单模块
		pagecontent:'.page_content',//自定义属性
		operation:'.operation',//自定义属性
		scrollbar:function(e){
			e.niceScroll({
				cursorcolor: "#dddddd",
				cursoropacitymax: 1,
				touchbehavior: false,
				cursorwidth: "3px",
				cursorborder: "0",
				cursorborderradius: "3px",
			});						
		},
		expand:function(thisBox,settings){	
			var pc="";
			$(settings.pagecontent).css("margin-bottom")!=null? pc=parseInt($(settings.pagecontent).css("margin-bottom").replace("px","")):'';
		    $(settings.pagecontent).css({height:$(window).height()-$(settings.operation).outerHeight()-pc-(settings.padding*2)})
		    settings.scrollbar($(settings.slide) && $(settings.pagecontent));		    
		}//自定义方法
	});
 });
</script>
